#include <iostream>
#include <queue>

using namespace std;

#define F first
#define S second
#define E(p) p.F][p.S
using pos = pair<int, int>;

int main()
{
    freopen("maze1.in", "r", stdin);
    freopen("maze1.out", "w", stdout);
    int k;
    cin >> k;
    for (int _ = 0; _ < k; _++)
    {
        int n, ha, la, hb, lb;
        cin >> n;
        bool maze[n][n];
        for (int h = 0; h < n; h++)
            for (int l = 0; l < n; l++)
            {
                char pass;
                cin >> pass;
                maze[h][l] = pass == '.';
            }
        cin >> ha >> la >> hb >> lb;
        bool got[n][n] = {{false}};
        bool ok = false;
        queue<pos> pending;
        pending.push({ha, la});
        while (!pending.empty())
        {
            pos now = pending.front();
            got[E(now)] = true;
            pending.pop();
            if (now.F == hb && now.S == lb)
            {
                ok = true;
                break;
            }
            if (now.F > 0 && maze[now.F - 1][now.S] && !got[now.F - 1][now.S])
                pending.push({now.F - 1, now.S});
            if (now.S > 0 && maze[now.F][now.S - 1] && !got[now.F][now.S - 1])
                pending.push({now.F, now.S - 1});
            if (now.F < n - 1 && maze[now.F + 1][now.S] && !got[now.F + 1][now.S])
                pending.push({now.F + 1, now.S});
            if (now.S < n - 1 && maze[now.F][now.S + 1] && !got[now.F][now.S + 1])
                pending.push({now.F, now.S + 1});
        }
        cout << (ok ? "YES" : "NO") << endl;
    }
    return 0;
}
